/*
 * WriteInt.cpp
 *
 *  Created on: 17.04.2012
 *      Author: Eugene Kornykhin
 */

#include "Write.h"

Write::Write(const Writer &writer)
: writer(writer.clone()) {

}

Write::~Write() {
	delete writer;
}

void Write::execute(Interpreter& interpreter) {
	writer->write(interpreter);
}

PolizPosition Write::next_position_after(PolizPosition c) const {
	return c.next();
}

bool Write::isHalt() const {
	return false;
}

Write* Write::clone(const Poliz &) const {
	return new Write(*writer);
}

Write::Write(const Write & write)
: writer(write.writer->clone())
{

}

Write & Write::operator =(const Write & write)
{
	Writer *w = write.writer->clone();
	delete writer;
	writer = w;
	return *this;
}

string Write::toString() const {
	return writer->toString();
}

